package com.springboot3login.controller;

import com.springboot3login.domain.Result;
import com.springboot3login.domain.dto.UserLoginDTO;
import com.springboot3login.domain.vo.UserLoginVO;
import com.springboot3login.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@Tag(name = "用户接口")
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @Operation(summary = "你好")
    @GetMapping("/hello")
    public Object test2(){
        return "hello";
    }

    /**
     * 用户登录
     */
    @GetMapping(value = "login")
    public Result<UserLoginVO> login(@Valid UserLoginDTO dto){
        return userService.login(dto);
    }

}